import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;


public class student {

	Connection connection = null;
	ResultSet resultSet = null;
	Statement statement = null;
	String name=null;
	public  int id;
	public  String course;
	static student s1=new student();
	private String grade=null;
	//ReferenceMonitor Con=new ReferenceMonitor();
	ReferenceMonitor RM=new ReferenceMonitor();
	public static void main(String[] args){	
		//s1.getgrade(id,course);
	}
	student(){}
	
	public String getaction(String[] line)
	{
		//S,id,method,additional if needed 
		if (line[2].equals("get_transcript"))
		{ String res=RM.gettranscript(line[1]);
			return(res);
		}
		else if (line[2].equals("GET_PII")){
			
			return(GET_PII(line));
		}
		else if (line[2].equals("get_courses"))
		{
			String res=get_my_course(line[1]);
			return(res);
		}
		else
			return "";
	}
	
	public String GET_PII(String[] line)
	{
		System.out.println("STU Main: ");
		return ( RM.GET_PII() );	
	}
	
	public String get_my_course( String id)
	{
		String n=RM.get_my_courses(id);
		return( n );
	}
//	public String GetCourses( String[] Id )
//	{
//		grade="";
//		try {
//			Con.start();
//			Con.statement = Con.connection.createStatement();
//			Con.resultSet = Con.statement.executeQuery("select Grade.CourseNum from Grade where StudentId IN (select ObjectName from PrivilegesInfo where SubjectName ='"+Id+"' and SetPriv='VG')");
//			while (Con.resultSet.next()) {
//				grade=Con.resultSet.getString("GradeType");	
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		} finally {
//			try {
//				Con.resultSet.close();
//				Con.statement.close();
//				Con.connection.close();
//			} catch (Exception e) {
//				e.printStackTrace();
//			}
//		}
//		return("");
//	}
//	
//
//	public String getgrade(int Id)
//	{	String s="";
//		try {
//			Con.start();
//			Con.statement = Con.connection.createStatement();
//			Con.resultSet = Con.statement.executeQuery("select Grade.CourseNum,Grade.StudentId,Grade.GradeType from Grade where StudentId='"+Id+"' and CourseNum IN (select ObjectName from PrivilegesInfo where SubjectName ='"+Id+"' and SetPriv='VG')");
//			while (Con.resultSet.next()) {
//				//grade=Con.resultSet.getString("GradeType");	
//				s+=Con.resultSet.getString("CourseNum")+";";
//				s+=Con.resultSet.getString("GradeType")+";";
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		} finally {
//			try {
//				Con.resultSet.close();
//				Con.statement.close();
//				Con.connection.close();
//			} catch (Exception e) {
//				e.printStackTrace();
//			}
//		}
//		return ("S;get_transcript;"+s);
//	}
}
